const {
  default: userStore
} = require("@/store/userStore")
const {
  ComponentWithStore
} = require("mobx-miniprogram-bindings")

// pages/comment/comment-card/comment-card.js
ComponentWithStore({
  storeBindings: {
    store: userStore,
    fields: ['userInfo']
  },
  properties: {
    comment: {
      id: String,
      uid: String,
      user: {
        avatar: String,
        nickname: String,
      },
      stars: Number,
      picList: Array,
      content: String,
      createTime: String
    }
  },

  methods: {
    async deleteComment() {
      console.log('comment-id', this.data.comment.id)
      this.triggerEvent('removeComment', this.data.comment.id)
    },
    previewPic(event) {
      wx.previewImage({
        current: event.target.dataset.current,
        urls: event.target.dataset.piclist,
      })
    }
  }
})